#!/bin/sh
ovs-vsctl add-br br-ex
ovs-vsctl add-port br-ex eth1
ovn-nbctl ls-add outside
ovn-nbctl lrp-add router router1-outside 02:ac:10:ff:00:02 192.168.166.112/16
ovn-nbctl lsp-add outside outside-router1
ovn-nbctl lsp-set-type outside-router1 router
ovn-nbctl lsp-set-addresses outside-router1 02:ac:10:ff:00:02
ovn-nbctl lsp-set-options outside-router1 router-port=router1-outside
ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=physnet1:br-ex
ovn-nbctl lsp-add outside outside-localnet
ovn-nbctl lsp-set-addresses outside-localnet unknown
ovn-nbctl lsp-set-type outside-localnet localnet
ovn-nbctl lsp-set-options outside-localnet network_name=physnet1

ovn-nbctl lr-nat-add router snat 192.168.166.112 10.0.0.0/24
#ovn-nbctl lr-nat-add router snat 192.168.166.111 10.1.0.0/24
ovn-nbctl lr-route-add router "0.0.0.0/0" 192.168.2.1
#ovn-nbctl lr-nat-add router dnat 192.168.166.111 10.0.0.10
#ovn-nbctl lr-nat-add router dnat_and_snat  192.168.166.111 10.0.0.10
#ovn-nbctl lr-nat-update-ext-ip router dnat_and_snat 10.0.0.10 allowed_range
